<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工管理</title>
<!-- 导入jquery核心类库 -->
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
<!-- 导入easyui类库 -->
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/js/easyui/ext/portal.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/css/default.css">	
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyui/ext/jquery.portal.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/easyui/ext/jquery.cookie.js"></script>
<script
	src="${pageContext.request.contextPath }/js/easyui/locale/easyui-lang-zh_CN.js"
	type="text/javascript"></script>

<script type="text/javascript">

	
	function getQueryParams(queryParams) {  
		var searchcontent = $('#searchcontent').val();
	     queryParams.rSRsn = searchcontent;  
	     return queryParams;  
	   
	 }  
	
	 //增加查询参数，重新加载表格  
    function reloadgrid() {  
  
        //查询参数直接添加在queryParams中      
        var queryParams = $('#grid').datagrid('options').queryParams;  
        getQueryParams(queryParams);  
        $('#grid').datagrid('options').queryParams = queryParams;  
        $("#grid").datagrid('load');  
    }  
	 
    function doExport(){
    	$.messager.alert('提示', "正在完善中...",'info')
    }
	 function doSearch(){			
		reloadgrid();
	}


	// 定义列
	var columns = [ [ {
		field : 'rSRsn',
		title : 'E尺SN',
		width : 80,	
	},{
		field : 'rSSdkId',
		title : 'SDKID',
		width : 80,	
	},{
		field : 'rSScanData',
		title : '扫描信息',
		width : 600,	
		formatter:formatterData
	},{
		field : 'rSUserData',
		title : '客户信息',
		width : 250,	
		formatter:formatterData
	},{
		field : 'rSDateTime',
		title : '上传时间',
		width : 110,
		formatter:formatterDate
	}] ];
	
	function formatterData(value){
		if(value=='{}'){
			return '无'
		}else{
			return value
		}
	}
	function formatterDate(value,row,index){
		if(value==''||null==value){
			return '';
		}
		var now = new Date(parseInt(value) * 1000);  
		var year=now.getYear()+1900; 
		var month=now.getMonth()+1; 
		var date=now.getDate(); 
		var hour=now.getHours(); 
		var minute=now.getMinutes();
		minute= (minute > 9) ? minute=minute : minute='0'+minute;
		//var second=now.getSeconds(); 
		return year+"-"+month+"-"+date+" "+hour+":"+minute; 
	}


	$(function(){
	
		$('#search').click(doSearch);
	});
	$(function(){
		// 先将body隐藏，再显示，不会出现页面刷新效果
		$("body").css({visibility:"visible"});
		var sdkId = $('#sdkId').val();
		$('#return').click(function(){
			 
			location.href="${pageContext.request.contextPath}/page.sdks.ashx"

	 });
		if(!sdkId){
			 $('#return').remove();
			 
		}
		// 收派标准数据表格
		$('#grid').datagrid( {
			iconCls : 'icon-forward',
			fit : true,
			border : false,
			rownumbers : true,
			singleSelect:true,
			striped : true,
			toolbar : '#tb',
			url : "${pageContext.request.contextPath}/page.rsdList.ashx",
			idField : 'rSId',
			columns : columns,
			pageList: [10,25,50],
			pagination:true,
			view:myview,
			emptyMsg:"<font size=5>暂无记录</font>",
			singleSelect: false,
			selectOnCheck: true,
			checkOnSelect: true,
			queryParams:{
				rSSdkId:sdkId
			}
				
			
		});
		
		
	});
	
	
	
	var myview = $.extend({},$.fn.datagrid.defaults.view,{
		onAfterRender:function(target){
			$.fn.datagrid.defaults.view.onAfterRender.call(this,target);
			var opts = $(target).datagrid('options');
			var vc = $(target).datagrid('getPanel').children('div.datagrid-view');
			vc.children('div.datagrid-empty').remove();
			if (!$(target).datagrid('getRows').length){
				var d = $('<div class="datagrid-empty"></div>').html(opts.emptyMsg || 'no records').appendTo(vc);
				d.css({
					position:'absolute',
					left:0,
					top:50,
					width:'100%',
					textAlign:'center'
				});
			}
		}
	});
	
	

	
	
		
</script>	
</head>
<body class="easyui-layout" >
<input id="sdkId" hidden="hidden" value="${sdkId}">
	<div region="center">
	
		<table id="grid">
		
		</table>
	</div>
	
	<div id="tb" style="padding:5px;height:auto">
	
		<div style="margin-bottom:5px">
		<a id="return"  icon="icon-undo" href="#" class="easyui-linkbutton" plain="true" >返回</a>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E尺SN: <input id="searchcontent" class="easyui-textbox" style="width:80px">
			<a href="#"  id="search" class="easyui-linkbutton" iconCls="icon-search">搜索</a>
		
		</div>
	</div>
</body>
</html>